<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var str = 'qpopopopaaajjkqqqpppp'
        var obj = {};
        for (var i = 0; i < str.length; i++) {
            if (obj[str[i]]) {
                obj[str[i]]++
            } else {
                obj[str[i]] = 1;
            }
        }
        console.log(obj);
        var max = 0;
        var maxK = '';
        for (var k in obj) {
            if (obj[k] > max) {
                max = obj[k];
                maxK = k;
            }
        }
        console.log('该字符串出现最多的字符是' + maxK + ' 出现的次数是' + max + '次');
    </script>
</head>

<body>

</body>

</html>